﻿using System;
using System.Web.UI;
using Highcharts.Core;
using Highcharts.Core.Appearance;
using Highcharts.Core.Data.Chart;

namespace DemoWebforms
{
    public partial class Sample08 : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {            
                Exemplo08();
        }

        private void Exemplo08()
        {
            hcVendas.Appearance = new Appearance { renderTo = "container", zoomType = "x" };
            hcVendas.YAxis.Add(new YAxisItem { title = new Title("Faturamento"), type = AxisDataType.linear });
            hcVendas.XAxis.Add(new XAxisItem { maxZoom = 5, labels = (new Labels { rotation = 45, step = 2 }) });

            var series = new SerieCollection
                {
                    new Serie
                        {
                            id = "Serie1",
                            type = RenderType.areaspline,
                            data = new object[] {412, 711, 523, -147, 149, null, 222, 434, 43, 432, 115, 667}
                        },
                    new Serie
                        {
                            id = "Serie2",
                            type = RenderType.spline,
                            data = new object[] {711, 523, 412, 434, 147, 122, 149, 222, 432, 667, 43, 115}
                        }
                };

            // JSON Data Source
            hcVendas.AjaxDataSource = new AJAXSource("./AJAXtest.aspx", 5000, false, false, true); // (source, delay, clearAll, onlyOnce, shift)
            
            //bind do controle
            hcVendas.DataSource = series;
            hcVendas.DataBind();
        }

    }
}